package com.cssl.openFeign;

import com.cssl.domain.dto.UserAccountDto;
import com.cssl.domain.dto.UsersDto;
import com.cssl.domain.dto.WeiXinLoginDto;
import com.cssl.domain.dto.WeiXinRegistryByPhoneDto;
import com.cssl.util.InfoCode;
import com.cssl.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Date;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@FeignClient(value = "DtsShopProvider9090", path = "/users", contextId = "3")
public interface UsersFeignClient {
    /**
     * 发送短信接口(复制原本的接口)
     *
     * @param req
     * @return
     */
    @PostMapping("/sendMess")
    Result sendMess(@RequestBody Map<String, Object> req);

    /**
     * 手机号注册并登录
     *
     * @param dto
     * @return user对象和saToken
     */
    @PostMapping("/weiXinRegisterByPhone")
    Result weiXinRegisterByPhone(@RequestBody WeiXinRegistryByPhoneDto dto);

    /**
     * 用户名,密码登录
     *
     * @param map 接收的参数 1.username 2.password 3.code
     * @return
     */
    @PostMapping("/weiXinLoginByPwd")
     Result weiXinLoginByPwd(@RequestBody Map map);

    /**
     * 测试
     *
     * @return
     */
//    @PostMapping("/test")
//    Integer test();

    /**
     * 重置密码
     *
     * @param map 1.phone 2.yzm 3.password
     *            验证码错误返回状态码422
     *            密码与原密码一致返回403
     *            修改失败返回400
     *            修改成功200,true
     * @return
     */
    @PostMapping("/resetPassword")
     Result resetPassword(@RequestBody Map<String,Object> map);

    /**
     * 微信登录
     *
     * @param weiXinLoginDto 接收code
     * @return code错误和openId为空返回403
     * 没有此人返回204
     * 请求成功返回200 saToken , user
     */
    @PostMapping("/weiXinLogin")
    Result weiXinLogin(@RequestBody WeiXinLoginDto weiXinLoginDto);

    @PostMapping("/usersList")
    public Result getUsersList(@RequestBody UsersDto usersDto);

    @PostMapping("/approveAgency")
    public Result UpdateStatus(@RequestBody UserAccountDto userAccountDto);

    @PostMapping("/userProxy")
     Result userProxy(@RequestBody Map<String,Object> map);
    /**
     * 清除用户全部历史搜索记录
     * @return
     */
    @PostMapping("/deleteHistory")
    Result deleteHistory();


    @PostMapping("/test")
     Result test();

    @PostMapping("/collectTrueOrFalse")
     Result collectTrueOrFalse(@RequestBody Map map);
}
